﻿using System;
using SpecFlowTfsLinker.Entities;

namespace SpecFlowTfsLinker.Test.Resources
{
    public class TestCaseTester
    {
        public string FeatureStatement { get; set; }
        public int NumberOfParameters { get; set; }
        public string FinalStatement { get; set; }
        private const string MethodDeclaration = "public void {0}({1})";
        public string BaseWihoutGherkin { get; set; }
        public StatementType Type { get; set; }
        public string BaseStatement { get; set; }
        public string FinalMethodStatement { get; set; }
        public string Parameters { get; set; }
        public string MethodName { get; set; }

        public string CompleteMethodHeader
        {
            get { return string.Format(MethodDeclaration, MethodName, Parameters); }
        }

        public Statement Statement
        {
            get
            {
                switch (Type)
                {
                    case StatementType.Given:
                        return Statement.Given(BaseStatement);
                    case StatementType.When:
                        return Statement.When(BaseStatement);
                    case StatementType.Then:
                        return Statement.Then(BaseStatement);
                    default : throw new ArgumentException();
                }
            }
        }
    }
}